package com.tl.boot.common.enums;

/**
 * com.tl.boot.common.enums -- StatusEnum
 * Description:
 * Created by joshua_liu <a href="mailto:joshualwork@163.com"></a>
 * On 2019/9/16 14:13
 */
public enum StatusEnum {

    VALID(1, "有效"),
    INVALID(0, "无效"),
    ;
    private Integer code;
    private String info;

    public Integer getCode() {
        return code;
    }

    public String getInfo() {
        return info;
    }

    StatusEnum(Integer code, String info) {
        this.code = code;
        this.info = info;
    }

    public static StatusEnum getInstanceByCode(Integer code) {
        for (StatusEnum e : StatusEnum.values()) {
            if (e.getCode() == code) {
                return e;
            }
        }
        return null;
    }
}

